package com.hx.jvm.proxy.cglib.aop;

import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * @author jxlgcmh
 * @date 2020-08-16 21:36
 * @description
 */
@Aspect({ServiceA.class, ServiceB.class})
public class ServiceLogAspect {
    /**
     * 日志处理器前置方法
     *
     * @param target
     * @param method
     * @param args
     */
    public static void before(Object target, Method method, Object[] args) {
        System.out.println("entering " + method.getDeclaringClass().getSimpleName() + "::" + method.getName() + ",args: " + Arrays.toString(args));
    }

    /**
     * 日志处理后置方法
     *
     * @param target
     * @param method
     * @param result
     */
    public static void after(Object target, Method method, Object[] args, Object result) {
        System.out.println("leaving " + method.getDeclaringClass().getSimpleName() + "::" + method.getName() + ",result: " + result);
    }
}
